package com.astersoft.lib.util.mail;

/*
 * Copyright 2012 AsterSoft personal developer - Licensed under the Apache
 * License, Version 2.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
 * or agreed to in writing, software distributed under the License is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

import java.io.File;

public class ASEmail {
    public String from;
    public String to;
    public String subject;
    public String body;
    public File[] attachments;
    public boolean htmlText = false;

    public ASEmail() {}
    
    public ASEmail(String from, String to, String subject, String body) {
    	this(from, to, subject, body, null, false);
    }
    
    public ASEmail(String from, String to, String subject, String body, File[] attach) {
    	this(from, to, subject, body, attach, false);
    }
    
    public ASEmail(String from, String to, String subject, String body, boolean htmlText) {
    	this(from, to, subject, body, null, htmlText);
    }
    
    public ASEmail(String from, String to, String subject, String body, File[] attach, boolean htmlText) {
    	this.from = from;
    	this.to = to;
    	this.subject = subject;
    	this.body = body;
    	this.attachments = attach;
    	this.htmlText = htmlText;
    }
    
    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer();

        sb.append("Sender: ");
        sb.append(from);
        sb.append("\n");

        sb.append("Subject: ");
        sb.append(subject);

        sb.append("\n");
        sb.append("To: ");
        sb.append(to);

        sb.append("\n");
        sb.append("Body: ");
        sb.append(body);

        sb.append("\n");
        sb.append("HTML Text: ");
        sb.append(htmlText);
        
        sb.append("\n");
        sb.append("Attachments: ");
        for(File f: attachments)
        	sb.append(f.getName() + "\n");

        sb.append("\n");

        return sb.toString();
    }
}
